import requests
import time
from fake_useragent import UserAgent


class Http_Clien:
    ua = UserAgent()
    timeout = 5

    headers = {
        'User-Agent': str(ua),
        'accept': '*/*',
        'accept-language': 'zh-CN;q=0.9,zh;q=0.8',
        'content-type': 'pplication/json',
        'dnt': '1',
        'sec-fetch-dest': 'empty',
        'sec-fetch-mode': 'cors',
        'sec-fetch-site': 'same-origin',
    }

    @classmethod
    def get_proxy(cls):
        return requests.get("http://118.24.52.95:5010/get/").json()

    @classmethod
    def single_get(cls, start_url):
        time.sleep(5)
        cls.headers["referer"] = start_url
        response = requests.get(start_url, headers=cls.headers, timeout=cls.timeout)
        return response.text
